<template>
	<view class="factoryDetail">
		<text class="factoryName">{{factory.name}}</text>	
		<image class="img" v-if="factory.phone" :src="factory.phone+'?imageView2/2/w/750/q/85'" mode="widthFix"></image>
		<text class="address">地址：{{factory.address}} </text>
		<rich-text class="intro" :nodes="factory.companyProfile"></rich-text>
		<view v-if="factory.videoUrl">
			<image class="img" v-for="item in factory.videoUrl.split(',')" :key="item" :src="item+'?imageView2/2/w/750/q/85'" mode="widthFix"></image>
		</view>
	</view>
</template>

<script>
export default {
	data() {
		return {
			factory:{
				address: "",
				companyProfile: "<p></p>",
				createBy: "",
				name:'',
			},
			factoryId:'',
		}
	},
	onLoad(query) {
		console.log(query.id)
		// this.factoryId=query.id
		this.getList(query.id);
		// this.getDetail(query.id)
	},
	onShareAppMessage(){
	},
	methods: {
		getList(id){
			const requestParam = {
				url: "/app/mall/getMallMerchantInfoList",
				method: "GET",
				data:{
					pageNum: 1,
					pageSize:50,
				},
				callBack: (res) => {
					console.log(res)
					res.rows.forEach(x=>{
						if(id==x.id){
							this.factory=x;
							console.log(this.factory)
						}
					})
				}
			}
			this.$request(requestParam);
		},
		getDetail(id){
			const requestParam = {
				url: "/app/mall/getMallMerchant",
				method: "GET",
				data:{
					id:id
				},
				callBack: (res) => {
					console.log(res)
					this.factory=res.data;
				}
			}
			this.$request(requestParam);
		}
	}
}
</script>

<style lang="scss">
	@import './style.scss';
</style>
